<?php if (!defined('BASEPATH')) exit('No direct script access allowed');

/**
 * YB Board Class
 *
 * Board library for Code Igniter.
 *
 * @author		Yashpal Bharadwaj
 * @version		0.5
 * @link		http://
 * @license		MIT License Copyright (c) 2009 Yashpal Bharadwaj
 * @credits		http://
 */

class YB_Admin
{
	
	function YB_Admin()
	{
		$this->ci =& get_instance();

		log_message('debug', 'YB Admin Libary Initialized');

		// Load required library
		$this->ci->load->library('Session');
		$this->ci->load->database();
		
		//Load models
		$this->ci->load->model(array('board/Category_model','board/Forum_model'));
                
		
		// Load YB Board config
		$this->ci->load->config('yb_board');
		
		// Load language		
		//$this->ci->lang->load('dx_auth');
		
		// Load  event
		//$this->ci->load->library('DX_Auth_Event');
		
		// Initialize
		$this->_init();
	}

	/* Private function */

	function _init()
	{
		// Init helper config variable
		


		$this->YB_can_guest_browse =$this->ci->config->item('YB_can_guest_browse');
		$this->YB_can_view_board   =$this->ci->config->item('YB_can_view_board');
		$this->YB_can_view_forum   =$this->ci->config->item('YB_can_view_forum');
		$this->YB_can_view_category=$this->ci->config->item('YB_can_view_category');
		$this->YB_can_view_thread  =$this->ci->config->item('YB_can_view_thread');
		$this->YB_enable_similies  =$this->ci->config->item('YB_enable_similies'); 
		$this->YB_view_online      =$this->ci->config->item('YB_view_online');     
		$this->YB_view_memberlist  =$this->ci->config->item('YB_view_memberlist');
		$this->YB_view_board_stat  =$this->ci->config->item('YB_view_board_stat');
		
	        //grab value from session 
                $this->DX_user_id           =$this->ci->session->userdata('DX_user_id');
		$this->DX_username          =$this->ci->session->userdata('DX_username');
		$this->DX_role_id           =$this->ci->session->userdata('DX_role_id');
		$this->DX_role_name         =$this->ci->session->userdata('DX_role_name');
		$this->DX_parent_roles_id   =$this->ci->session->userdata('DX_parent_roles_id');
		$this->DX_parent_roles_name =$this->ci->session->userdata('DX_parent_roles_name');
		$this->DX_permission        =$this->ci->session->userdata('DX_permission');
		$this->DX_parent_permissions=$this->ci->session->userdata('DX_parent_permissions');
		$this->DX_logged_in         =$this->ci->session->userdata('DX_logged_in');
	}
	
	
	/**
         *   Functions used to insert value into the database
         *
         *   This section deals all category CRUD operations
         */

        function create_category()
        {
            return $this->ci->Category_model->create_category();
        }

        function edit_category()
        {
            return $this->ci->Category_model->edit_category();
        }

        function delete_category()
        {
            return $this->ci->Category_model->delete_category();
        }

        function manage_categories()
        {
            return $this->ci->Category_model->manage_categories();
        }

        function list_categories()
        {
            return $this->ci->Category_model->list_categories();
        }

        /**
         *   Functions used to insert value into the database
         *
         *   This section deals all forum CRUD operations
         */

        function create_forum()
        {
            return $this->ci->Forum_model->create_forum();
        }

        function edit_forum()
        {
            return $this->ci->Forum_model->edit_forum();
        }

        function delete_forum()
        {
            return $this->ci->Forum_model->delete_forum();
        }

        function manage_forums()
        {
            return $this->ci->Forum_model->manage_forums();
        }




}
?>